import './localhost.scss'
import { useMount } from "ahooks"
import { useRequest } from "alova/client"

import { Http } from '../../Utils/Api'
import { useState } from 'react';


const LogInLocalhost = () => {
    const [ProjectList, setProjectList] = useState()
    const { send } = useRequest(() => Http({ url: 'getAdminA06ProjectList' }), { immediate: false })
    useMount(() => send().then(res => setProjectList(res.data)))

    return (
        <div className="LogInLocalhost">
            {ProjectList && ProjectList.map(({ label, value }, index) =>
                <div
                    key={index}
                    className='container'
                    onClick={() => (window.location.href = `http://${value}:${window.location.port}`)}
                >
                    <div className='btn'>{label}</div>
                </div>
            )}
        </div>
    )
}

export default LogInLocalhost;